package com.xin.data.simbapesa.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.xin.data.simbapesa.base.BaseBindingAdapter1;
import com.xin.data.simbapesa.databinding.SimbaMsgtitleItemBinding;
import com.xin.data.simbapesa.utils.ViewUtils;

import java.util.List;

public class MsgTitleAdapter extends BaseBindingAdapter1<String, SimbaMsgtitleItemBinding> {


    public MsgTitleAdapter(List<String> dataList) {
        super(dataList);
    }

    @Override
    protected void bindData(SimbaMsgtitleItemBinding binding, String item, int position) {
        binding.tvItem1.setText(item);

        if (position == dataList.size() - 1) {
            binding.tvLine.setVisibility(View.GONE);
        } else {
            binding.tvLine.setVisibility(View.VISIBLE);
        }

        binding.getRoot().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ViewUtils.viewScale(v);
                if (onBtnItemClickListener != null) {
                    onBtnItemClickListener.onItemClick(position);
                }
            }
        });

    }

    @Override
    protected int getItemType(String item) {
        return 0;
    }

    @Override
    protected SimbaMsgtitleItemBinding createBinding(LayoutInflater inflater, ViewGroup parent, int viewType) {
        return SimbaMsgtitleItemBinding.inflate(inflater,parent,false);
    }


}
